package com.topvision.common.serialize;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.topvision.common.utils.EnumUtils;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @Title: EnumNullSerialize
 * @Package com.topvision.common.serialize
 * @Description: TODO
 * @author shengwm
 * @date 2017/4/23 15:12
 * @version V0.0.1
 */
public class EnumNullSerialize extends JsonSerializer<Object> {
	
	@Override
	public void serialize(Object value, JsonGenerator jgen,
			SerializerProvider provider) throws IOException,
			JsonProcessingException {
		
		Map<Object, Object> map = new HashMap<Object,Object>();
		map.put(EnumUtils.OUTPUT_CODE, null);
		map.put(EnumUtils.OUTPUT_NAME, null);
		jgen.writeObject(map);
	}
}